home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / euro_gen.cpp < prev    next >
C/C++ Source or Header  |  1996-03-20  |  29KB  |  1,011 lines

  1. #include <iostream.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <conio.h>
  6.  
  7. #include "eurodefs.h"
  8. #include "euro_fxd.h"
  9. #include "euro.equ"
  10. #include "euro_sym.h"
  11. #include "euro_def.h"
  12. #include "euro_var.h"
  13. #include "euro_grf.h"
  14. #include "euro_dsk.h"
  15. #include "euro_fix.h"
  16. #include "euro_sel.h"
  17. #include "euro_inf.h"
  18. #include "euro_cnt.h"
  19. #include "euro_usr.h"
  20. #include "euro_net.h"
  21. #include "euro_mod.h"
  22. #include "euro_sqd.h"
  23. #include "euro_rnd.h"
  24. #include "euro_mat.h"
  25. #include "euro_int.h"
  26.  
  27. #include "defines.h"
  28.  
  29. //********************************************************************************************************************************
  30. //
  31. //char    *GetTEXT( short StringNumber )
  32. //{
  33. //    return( (char *)Text[ StringNumber ] );
  34. //}
  35. //
  36. ////********************************************************************************************************************************
  37.  
  38. char    *ToUPPER( char *string )
  39.     {
  40.  
  41.     char    len = strlen(&string[0]);
  42.     for ( char u=0; u < len; u++ )
  43.     { StringBuffer[u] = ToUpper[ *(string+u) ]; }        
  44.     StringBuffer[u]     = 0;
  45.     return( &StringBuffer[0] );
  46.     }
  47.  
  48. //********************************************************************************************************************************
  49. //
  50. //char    *GetTEAMname( char team, char maxlen )
  51. //    {
  52. //        char    *Name        =    GetTEXT( TEAM_NMES+team );
  53. //        char    Searchlen    =    strlen(&Name[0]);
  54. //        char    NAMEoffset    =    0;
  55. //
  56. //        for ( char x=0; x<Searchlen ; x++ )
  57. //            {StringBuffer[x]     = * (Name+x);}
  58. //        StringBuffer[x]     = 0;
  59. //
  60. //        if ( maxlen!=0 && Searchlen > maxlen )
  61. //            {
  62. //                StringBuffer[maxlen-1] = '.';
  63. //                StringBuffer[maxlen] = 0;
  64. //            }
  65. //
  66. //    return    ( &StringBuffer[0] );
  67. //    }
  68. //
  69. //
  70. //
  71. //********************************************************************************************************************************
  72. //
  73. //char    *GetPLAYERSname( char player, char team, char format )
  74. //    {
  75. //        short    Prefix        =    (team*20)+player;
  76. //        char    *Search        =    GetTEXT( PLYR_NMES+Prefix );
  77. //        char    NAMEoffset    =    0;
  78. //        char    Searchlen    =    strlen(&Search[0]);
  79. //        unsigned char     c;
  80. //        
  81. //        if ( format == FULL_NAME )
  82. //        {    
  83. //            for ( char x=0; x < Searchlen ; x++ )
  84. //                {StringBuffer[x]    = *(Search+x);}
  85. //            StringBuffer[x]    = 0;
  86. //        }
  87. //
  88. //
  89. //        if ( format == INITIAL_SURNAME )
  90. //        {    
  91. //            // *** Get players initials ***
  92. //        
  93. //            for ( char x=0; x < Searchlen ; x++ )
  94. //                {
  95. //                    if ( IsUpper[ *(Search+x) ] == up && 
  96. //                         IsUpper[ *(Search+(x+1)) ] == lw && 
  97. //                        NAMEoffset < (NAME_BUFFER_LEN-3) ) 
  98. //                    {
  99. //                        StringBuffer[NAMEoffset]     = *(Search+x);
  100. //                        NAMEoffset++;
  101. //        
  102. //                        if ((*(Search+x))=='-')
  103. //                            StringBuffer[NAMEoffset]     = '-';
  104. //                        else                                    
  105. //                            StringBuffer[NAMEoffset]     = '.';
  106. //        
  107. //                        StringBuffer[NAMEoffset+1]     = 32;
  108. //                        NAMEoffset+=    2;
  109. //                    }
  110. //        
  111. //                    if ((*(Search+x))=='-' && NAMEoffset >1 )
  112. //                    {
  113. //                              StringBuffer[NAMEoffset-2]     = '-';
  114. //                              NAMEoffset--;
  115. //                    }
  116. //                }    
  117. //        }
  118. //        
  119. //        if ( format == INITIAL_SURNAME || format == SURNAME )
  120. //        {    
  121. //        
  122. //            // *** Get players surname ***
  123. //        
  124. //            for ( char y=0; y < Searchlen ; y++ )
  125. //                {
  126. //                    if ( IsUpper[ *(Search+y) ] == up && 
  127. //                         IsUpper[ *(Search+(y+1)) ] == up && 
  128. //                        NAMEoffset < (NAME_BUFFER_LEN-3) ) 
  129. //
  130. //                    {
  131. //                        StringBuffer[NAMEoffset]     = *(Search+y);
  132. //        
  133. ////                        if ( (IsUpper[ *(Search+(y-1) ) ] == up && y>0) && 
  134. ////                             NamePREFIXtbl[Prefix] == 1 &&
  135. ////                             ( (StringBuffer[NAMEoffset-1]!='c' || 
  136. ////                            StringBuffer[NAMEoffset-2]!='M' && NAMEoffset>1 ) ) )
  137. ////                            {                                
  138. ////                                c = StringBuffer[NAMEoffset];
  139. ////                                StringBuffer[NAMEoffset] = ToLower[c];
  140. ////                            }
  141. //
  142. //
  143. //
  144. //                        if ( (IsUpper[ *(Search+(y-1) ) ] == up && y>0) )
  145. //                        {
  146. //                            c = StringBuffer[NAMEoffset];
  147. //
  148. //                            if ( ( StringBuffer[NAMEoffset-2]=='M' &&
  149. //                                   StringBuffer[NAMEoffset-1]=='c' && 
  150. //                                   NAMEoffset>1 && NamePREFIXtbl[Prefix] == 1 )
  151. //                               )
  152. //
  153. //                                c = StringBuffer[NAMEoffset];
  154. //
  155. //                            else
  156. //
  157. //                               {                                
  158. //                                c = StringBuffer[NAMEoffset];
  159. //                                StringBuffer[NAMEoffset] = ToLower[c];
  160. //                               }
  161. //
  162. //                        }
  163. //                        
  164. //                        NAMEoffset++;
  165. //                    }
  166. //        
  167. //                    else
  168. //                    
  169. //                        if ( IsUpper[ *(Search+y) ] == up && 
  170. //                             IsUpper[ *(Search+(y-1)) ] == up && 
  171. //                            NAMEoffset < (NAME_BUFFER_LEN-3) && y>0 ) 
  172. //                        {
  173. //                            StringBuffer[NAMEoffset]     = *(Search+y);
  174. //        
  175. //                            if ( IsUpper[ *(Search+(y-1)) ] == up && y>0 )
  176. //                            {                                
  177. //                                c = StringBuffer[NAMEoffset];
  178. //                                StringBuffer[NAMEoffset] = ToLower[c];
  179. //                            }
  180. //        
  181. //                            NAMEoffset++;
  182. //                    
  183. //                                if ( (*(Search+(y+1)))==' ')
  184. //                                {
  185. //                                    StringBuffer[NAMEoffset]     = 32;
  186. //                                    NAMEoffset++;
  187. //                                }
  188. //                        }
  189. //                }    
  190. //
  191. //            StringBuffer[NAMEoffset]    =    0;    // end of line.
  192. //        }
  193. //
  194. //        return    ( &StringBuffer[0] );
  195. //    }
  196. //
  197. //********************************************************************************************************************************
  198.  
  199. void DisplayTextInputCursor( int xpos, short CursorPosn, int ypos, char *string, int font, int colour, pseudo_info *pseudo, texture_info *texture  )
  200.     {
  201.         if ( CursorDisplaySpeed    > f2L(.5) )
  202.         {
  203.  
  204.             int    c;
  205.     
  206.             if ( CursorPosn>0 )
  207.             {        
  208.                 for ( short x=0; x < CursorPosn; x++ )
  209.                 {
  210.                       c=*string;
  211.     
  212.                     if ( c!=0 )                                
  213.                     {                    
  214.                         c = ASCtoImageTBL[c];
  215.                         c+=  font;
  216.                         string++;
  217.                         xpos+=    (Image_Widths[c])+1;
  218.                     }
  219.                 }
  220.             }
  221.     
  222.             c = 63+font;
  223.                   DrawIMAGE( pseudo, texture, c, xpos, ypos, NO_BOX, spriteinccopy );
  224.         }
  225.     }
  226.  
  227. //********************************************************************************************************************************
  228.  
  229. void    ResetAnimations()
  230.     {
  231.         for ( short a=0; a < MAX_ANIMATIONS; a++ )
  232.         {
  233.             Animation_table[a].StartFrame        =    -1;
  234.             Animation_table[a].EndFrame        =    -1;
  235.             Animation_table[a].Counter        =    0;
  236.             Animation_table[a].AnimationSpeed    =    0;
  237.             Animation_table[a].Bounding_box        =    NO_BOX;
  238.             Animation_table[a].Flags        =    0;
  239.             Animation_table[a].xposn        =    0;
  240.             Animation_table[a].yposn        =    0;
  241.         }                
  242.     }    
  243.  
  244. //********************************************************************************************************************************
  245.  
  246. short    AddAnimation( int xposn, int yposn, float StartFrame, float EndFrame, float Speed, signed char Box, signed char Flags )
  247.     {
  248.         short    handle    =    0;
  249.  
  250.  
  251.         for ( short a=0; a < MAX_ANIMATIONS; a++ )
  252.         {            
  253.             if ( Animation_table[a].StartFrame==-1 )
  254.             {
  255.                 Animation_table[a].StartFrame        =    StartFrame;
  256.                 Animation_table[a].EndFrame        =    EndFrame;
  257.                 Animation_table[a].AnimationSpeed    =    Speed;
  258.                 Animation_table[a].Bounding_box        =    Box;
  259.                 Animation_table[a].Flags        =    Flags;
  260.                 Animation_table[a].xposn        =    xposn;
  261.                 Animation_table[a].yposn        =    yposn;
  262.                 handle                    =    a;
  263.                 break;
  264.              }
  265.         }
  266.          return(handle);
  267.     }
  268.  
  269. //********************************************************************************************************************************
  270.  
  271. void InitialiseMenuPage( char MENU )
  272.     {
  273.         switch ( MENU )
  274.         {
  275.  
  276.             case( MAIN ):
  277.                 Euro96initialise();    //     reinitialise game data.
  278.                  EUROuserSelection    =    0;
  279.                 break;
  280.  
  281.             case( SQUAD_SELECT ):
  282.                 LoadTactics( ((int)FormationInfo[Team]), &EuroDATfile[0], &TeamTactics[0][0][0] );
  283.                 DisplaySquad();
  284.                 DisplayFormation( NULL );
  285.                 DisplayPositionLabels();
  286.                 MarkPlayer        =    -1;
  287.                 SquadBuffer1yposn    =    -1;
  288.                 QuestionHandle        =     AddAnimation( 488, 16, 
  289.                                  ( (float)QMRK_IMGS ), ( (float)QMRK_IMGS+19.1 ),
  290.                                  0.40, QUESTION_BOX, CONT_ANIM );
  291.                 FormationHandle        =     AddAnimation( NameBarXposn-16, 426,
  292.                                  ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  293.                                  0.0, FORMATION_BOX, RUN_ONCE );
  294.                 ReturnSqdHandle        =     AddAnimation( 308, 426,
  295.                                  ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  296.                                  0.0, RETURN_SQUAD_BOX, RUN_ONCE );
  297.                 ViewTeamHandle        =     AddAnimation( NameBarXposn-16, 106,
  298.                                  ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  299.                                  0.0, OPPONENT_TEAM_BOX, RUN_ONCE );
  300.                 break;
  301.  
  302.             case( GROUP_FIXTURES ):
  303.                 DisplayRedrawButton( MatchNumber );
  304.                 NextMatchHandle        =     AddAnimation( 507, 226, 
  305.                                  ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  306.                                  0.0, NXT_MTCH_BOX, CONT_ANIM );
  307.                 NextMatchHighlight    =      ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX, 
  308.                                  -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  309.                 break;
  310.  
  311.             case( TEAM_SELECT ):
  312.                 GetFirstLegalEuro96Team();
  313.                 ClickBOX        =    NO_BOX;
  314.                 SetupTeamSelectButtons( EUROgameType );
  315.                 SelectionSpeed        =    0;
  316.                 SelectionFlag        =    -1;
  317.                 SelectionAim        =    AimTBL[EUROteamA];
  318.                 SelectionCounter    =    ((float)SelectionAim)*4;
  319.                 DisplayGameType( EUROgameType );
  320.                 DisplayCountrySelectImages();
  321.                 DisplaySelectedTeam();
  322.                 break;
  323.  
  324.             case( EURO_REDRAW ):
  325.                 DisplayGroupHeadings();
  326.                 EuroDrawHandle        =    AddAnimation( 179, 234, 
  327.                                 ( (float)EURO_RDRW ), ( (float)EURO_RDRW+55.0 ),
  328.                                 0.40, QUESTION_BOX, CONT_ANIM );
  329.                 DefaultHandle          =    AddAnimation( 446, 380, 
  330.                                       ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  331.                                         0.0, DEFAULT_BOX, CONT_ANIM );
  332.                 DefaultdrawHighlight     =      ControlOptionHighlight( -1, DEFAULT_BOX,
  333.                                     DEFAULTdisp_BOX, -1, 
  334.                                     DefaultHandle, BUTN_LBLS+Default );
  335.                 EuroReDrawCounter    =    30.0;
  336.                 EuroReDrawFlag        =    -1;
  337.                 break;
  338.  
  339.             case( PLAYER_STATS ):
  340.                 DisplaySquad();
  341.                 DisplayPositionLabels();
  342.                 QuestionHandle        =    AddAnimation( 488, 16, 
  343.                                 ( (float)QMRK_IMGS ), ( (float)QMRK_IMGS+19.1 ),
  344.                                 0.40, QUESTION_BOX, CONT_ANIM );
  345.                 ReturnStatHandle    =    AddAnimation( 308, 416,
  346.                                 ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  347.                                 0.0, RETURN_PSTATS_BOX, CONT_ANIM );
  348.                 DisplayPlayerStats();
  349.                 break;
  350.  
  351.             case( PLAYER_SETUP ):
  352.                 DisplayUserSetupButtons( 0 );
  353.                 ClearNetUserList();
  354.                 InitNetUserSelection();
  355.                 EUROchampTeam    =     UserList[EUROplyrSetup].team;
  356.  
  357.                 if ( EUROgameType != EURO_championship )
  358.                 {
  359.                     DisplayMatchTeam( EUROteamA, 87,  0,  16, EUROmaxPlayers );
  360.                           DisplayUserTags( EUROteamA, 87,  0 );
  361.                     DisplayMatchTeam( EUROteamB, 352, 12, 32, EUROmaxPlayers );
  362.                           DisplayUserTags( EUROteamB, 352, 12 );
  363.                 }
  364.                 
  365.                 else
  366.  
  367.                 {
  368.                     DisplayMatchTeam( EUROchampTeam, 87,  0,  16, EUROnoOfMatchPlyrs  );
  369.                           DisplayUserTags( EUROchampTeam, 87,  0 );
  370.                     LoadPalette( BIN_BUL_PAL+( 8*EUROchampTeam),
  371.                      &EuroDATfile[0], 16 );
  372.                 }
  373.  
  374.                 DisplayUserInfo(EUROplyrSetup);
  375.                 DisplayUserHeadings(EUROplyrSetup);
  376.                 DisplayNETinfo();
  377.                 break;
  378.                 
  379.             case( TEAM_STATS ):
  380.                 ReturnTeamHandle         =     AddAnimation( 512, 426,
  381.                                  ( (float)BUTN_BLUE ), ( (float)BUTN_WHBL+11.9 ),
  382.                                  0.0, RETN_TSTATS_BOX, CONT_ANIM );
  383.                 RetnTstatHighlight     =      ControlOptionHighlight( -1, RETN_TSTATS_BOX,
  384.                                     RETN_TSTATSdisp_BOX, -1, 
  385.                                     ReturnTeamHandle, BUTN_LBLS+Done );
  386.  
  387.  
  388.                 ViewTeamHandle        =     AddAnimation( NameBarXposn-16, 106,
  389.                                  ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  390.                                  0.0, OPPONENT_TEAM_BOX, RUN_ONCE );
  391.                 break;
  392.  
  393.             case( MODEM_SETUP ):
  394.                 DisplayModemType();
  395.                 DisplayDialSetting();
  396.                 DisplayCommSetting();
  397.                 InitialiseInitString( EUROmodemType );
  398.                 DisplayInitString();
  399.                 DisplayModemList( ModemYpage );
  400.                 DisplayTelephoneNumber();
  401.                 ModemYpage = ControlSlider( &ModemSelectDEFN, 0, 0, 0 );
  402.                 break;
  403.  
  404.             case( NEXT_MATCH ):
  405.                 DisplayNextMatchType( EUROgameType );
  406.                 DisplayNextMatchUsers( EUROgameType );
  407.                 DisplayExtMatchTeams();
  408.                 NextMatchSelectButtons( EUROgameType );
  409.                 SetupChampionshipCntrls( EUROgameType );
  410.                 break;
  411.  
  412.             case( QUALIFIERS ):
  413.                 NextMatchHandle        =     AddAnimation( 446, 426, 
  414.                                  ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  415.                                  0.0, NXT_MTCH_BOX, CONT_ANIM );
  416.                 NextMatchHighlight    =      ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX, 
  417.                                  -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  418.                 break;
  419.  
  420.             case( QUARTER_FINALS ):
  421.                 NextMatchHandle        =     AddAnimation( 446, 426, 
  422.                                  ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  423.                                  0.0, NXT_MTCH_BOX, CONT_ANIM );
  424.                 NextMatchHighlight    =      ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX, 
  425.                                  -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  426.                 break;
  427.  
  428.             case( SEMI_FINALS ):
  429.                 NextMatchHandle        =     AddAnimation( 446, 426, 
  430.                                  ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  431.                                  0.0, NXT_MTCH_BOX, CONT_ANIM );
  432.                 NextMatchHighlight    =      ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX, 
  433.                                  -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  434.                 break;
  435.  
  436.             case( FINAL_MATCH ):
  437.                     
  438.                 DisplayString( 12, 98,
  439.                     GetTEXT ( FNAL_HEAD ),
  440.                     MEDIUM_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  441.  
  442.                 SpinningCupHandle     =    AddAnimation( 167, 129, 
  443.                                 ( (float)EUCP_IMGS ), ( (float)EUCP_IMGS+29.9 ),
  444.                                 0.40, EUROCUP_BOX, CONT_ANIM );
  445.                 NextMatchHandle        =     AddAnimation( 446, 426, 
  446.                                  ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  447.                                  0.0, NXT_MTCH_BOX, CONT_ANIM );
  448.                 NextMatchHighlight    =      ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX, 
  449.                                  -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  450.                 break;
  451.  
  452.         }
  453.  
  454.         SetupMouseLimits( 0, 626, 1, 452 );
  455.     }
  456.  
  457. //********************************************************************************************************************************
  458.  
  459. void    OverlayStaticBackgroundImages( char MENU )
  460.     {
  461.         int    width;
  462.         
  463.         switch ( MENU )
  464.         {
  465.             case( SQUAD_SELECT ):
  466.  
  467.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  468.                        SMLL_GOTH+Team, 550, 2, NO_BOX, spritecopy );      
  469.                 width       =    PixelLengthOfString( GetTEAMname( Team, 0 ),
  470.                                     LARGE_FONT);
  471.                 Image_Widths[INFO_NBAR+Lft]    =    Image_Widths[INFO_NBAR+Rgt]+width;
  472.  
  473.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  474.                        INFO_NBAR+Lft, NameBarXposn, 
  475.                        106, NO_BOX, spritecopy ); 
  476.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  477.                        INFO_NBAR+Rgt, NameBarXposn+Image_Widths[INFO_NBAR+Lft], 
  478.                        106, NO_BOX, spritecopy );    
  479.  
  480.                 Image_Widths[INFO_NBAR+Lft]    =    FORMATION_BAR_WIDTH;
  481.  
  482.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  483.                        INFO_NBAR+Lft, NameBarXposn, 
  484.                        426, NO_BOX, spritecopy );  
  485.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  486.                        INFO_NBAR+Rgt, NameBarXposn+Image_Widths[INFO_NBAR+Lft], 
  487.                        426, NO_BOX, spritecopy );  
  488.                 DisplayString( NameBarXposn+Image_Widths[INFO_NBAR+Rgt], 110,
  489.                           GetTEXT(Team+TEAM_NMES),
  490.                     LARGE_FONT, 24, TEAM_BOX, &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  491.                 break;
  492.  
  493.  
  494.             case( GROUP_FIXTURES ):
  495.                 CalculateLeagueTables();
  496.                 DisplayLeagueTables();
  497.                 DisplayLeagueFixtures( MatchNumber );
  498.                 break;
  499.  
  500.             case( TEAM_SELECT ):
  501.                   DisplayLowerSelectionPanel( EUROgameType );        
  502.                 DisplayCountrySelectImages();
  503.                       ReadData( BIN_DRAWPAL, &EuroDATfile[0], &SparePaletteBuffer[0] );
  504.                 memcpy( &PaletteBuffer[44*3], &SparePaletteBuffer[ (LeagueColourOffsets[EUROteamA]*3)+3 ], 7*3 );
  505.                 memcpy( &PaletteBuffer[51*3], &SparePaletteBuffer[ (LeagueColourOffsets[EUROteamB]*3)+3 ], 7*3 );
  506.                 break;
  507.  
  508.             case( PLAYER_STATS ):
  509.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  510.                        SMLL_GOTH+Team, 550, 2, NO_BOX, spritecopy );      
  511.                 break;
  512.                 
  513.             case( PLAYER_SETUP ):
  514.                 DisplayUserPanels( EUROgameType );
  515.                 DisplayUserLabels(EUROplyrSetup);
  516.                 break;
  517.                                 
  518.             case( TEAM_STATS ):
  519.                 width       =    PixelLengthOfString( GetTEAMname( EUROstatTeam, 0 ),
  520.                                     LARGE_FONT);
  521.                 Image_Widths[TBAR_STAT+Lft] =    Image_Widths[TBAR_STAT+Rgt]+width;
  522.  
  523.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  524.                        TBAR_STAT+Lft, NameBarXposn, 
  525.                        106, NO_BOX, spritecopy ); 
  526.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  527.                        TBAR_STAT+Rgt, NameBarXposn+Image_Widths[TBAR_STAT+Lft], 
  528.                        106, NO_BOX, spritecopy );    
  529.                 DisplayString( NameBarXposn+Image_Widths[TBAR_STAT+Rgt], 110,
  530.                           GetTEXT(EUROstatTeam+TEAM_NMES),
  531.                     LARGE_FONT, 36, NO_BOX, &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  532.  
  533.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  534.                        BCNT_IMGS+EUROstatTeam,
  535.                        TSTATCountryPosnDEFN[EUROstatTeam].xposn,
  536.                        TSTATCountryPosnDEFN[EUROstatTeam].yposn,
  537.                        NO_BOX, spritecopy );    
  538.                 DisplayTeamStats();
  539.                 break;
  540.  
  541.             case( MODEM_SETUP ):
  542.  
  543.                 ModemXposn    =    DisplayModemSetupPanel();
  544.                 break;
  545.  
  546.             case( NEXT_MATCH ):
  547.  
  548.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  549.                        LRGE_GOTH+EUROteamA,
  550.                        24, 146,
  551.                        NO_BOX, flipsprcopy );    
  552.  
  553.                 DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  554.                        LRGE_GOTH+EUROteamB,
  555.                        252, 146,
  556.                        NO_BOX, spritecopy );    
  557.  
  558.                 DisplayString( 237 - (PixelLengthOfString(GetTEXT( VRUS_LBLE ), LARGE_FONT))/2,
  559.                        414, GetTEXT( VRUS_LBLE ),
  560.                        LARGE_FONT, 22, NO_BOX, 
  561.                        &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  562.  
  563.                             break;
  564.  
  565.             case( QUALIFIERS ):
  566.                 DisplayQualifierGroupHeadings();
  567.                 DisplayQualifyingTeams();
  568.                 break;
  569.  
  570.             case( QUARTER_FINALS ):
  571.                 DisplayFinalRoundFixtures( MatchNumber, Menu );
  572.                 break;
  573.  
  574.             case( SEMI_FINALS ):
  575.                 DisplayFinalRoundFixtures( MatchNumber, Menu );
  576.                 break;
  577.  
  578.             case( FINAL_MATCH ):
  579.                 DisplayFinalRoundFixtures( MatchNumber, Menu );
  580.                 break;
  581.  
  582.         }
  583.     }
  584.  
  585. //********************************************************************************************************************************
  586.  
  587. void    SetupExtraTexturePages( int MENU )
  588.     {
  589.         switch ( MENU )
  590.         {
  591.             case( SQUAD_SELECT ):
  592.                 LoadTexturePage( BIN_PAGE2,
  593.                  &EuroDATfile[0],
  594.                  2, &FrontendTextureDEFN );
  595.                 LoadTexturePage( BIN_PAGE3,
  596.                  &EuroDATfile[0],
  597.                  3, &FrontendTextureDEFN );
  598.                     break;
  599.  
  600.             case( TEAM_SELECT ):
  601.                 LoadTexturePage( BIN_PAGE4,
  602.                  &EuroDATfile[0],
  603.                  2, &FrontendTextureDEFN );
  604.                 LoadTexturePage( BIN_PAGE5,
  605.                  &EuroDATfile[0],
  606.                  3, &FrontendTextureDEFN );
  607.                 LoadTexturePage( BIN_PAGE6,
  608.                  &EuroDATfile[0],
  609.                  4, &FrontendTextureDEFN );
  610.                 LoadTexturePage( BIN_PAGE7,
  611.                  &EuroDATfile[0],
  612.                  5, &FrontendTextureDEFN );
  613.                 LoadTexturePage( BIN_PAGE8,
  614.                  &EuroDATfile[0],
  615.                  6, &FrontendTextureDEFN );
  616.                 LoadTexturePage( BIN_PAGE9,
  617.                  &EuroDATfile[0],
  618.                  7, &FrontendTextureDEFN );
  619.                     break;
  620.  
  621.             case( EURO_REDRAW ):
  622.                 LoadTexturePage( BIN_PAGE10,
  623.                  &EuroDATfile[0],
  624.                  2, &FrontendTextureDEFN );
  625.                 LoadTexturePage( BIN_PAGE11,
  626.                  &EuroDATfile[0],
  627.                  3, &FrontendTextureDEFN );
  628.                 LoadTexturePage( BIN_PAGE12,
  629.                  &EuroDATfile[0],
  630.                  4, &FrontendTextureDEFN );
  631.                     break;
  632.  
  633.             case( PLAYER_STATS ):
  634.                 LoadTexturePage( BIN_PAGE2,
  635.                  &EuroDATfile[0],
  636.                  2, &FrontendTextureDEFN );
  637.                 LoadTexturePage( BIN_PAGE13,
  638.                  &EuroDATfile[0],
  639.                  3, &FrontendTextureDEFN );
  640.                     break;
  641.  
  642.             case( PLAYER_SETUP ):
  643.                 LoadTexturePage( BIN_PAGE13,
  644.                  &EuroDATfile[0],
  645.                  3, &FrontendTextureDEFN );
  646.                 LoadTexturePage( BIN_PAGE16,
  647.                  &EuroDATfile[0],
  648.                  4, &FrontendTextureDEFN );
  649.                 LoadTexturePage( BIN_PAGE20,
  650.                  &EuroDATfile[0],
  651.                  5, &FrontendTextureDEFN );
  652.                 LoadTexturePage( BIN_PAGE21,
  653.                  &EuroDATfile[0],
  654.                  6, &FrontendTextureDEFN );
  655.                 LoadTexturePage( BIN_PAGE22,
  656.                  &EuroDATfile[0],
  657.                  7, &FrontendTextureDEFN );
  658.                     break;
  659.  
  660.             case( TEAM_STATS ):
  661.                 LoadTexturePage( BIN_PAGE14,
  662.                  &EuroDATfile[0],
  663.                  4, &FrontendTextureDEFN );
  664.                 LoadTexturePage( BIN_PAGE15,
  665.                  &EuroDATfile[0],
  666.                  5, &FrontendTextureDEFN );
  667.                 LoadTexturePage( BIN_PAGE16,
  668.                  &EuroDATfile[0],
  669.                  6, &FrontendTextureDEFN );
  670.                     break;
  671.  
  672.             case( NEXT_MATCH ):
  673.                 LoadTexturePage( BIN_PAGE17,
  674.                  &EuroDATfile[0],
  675.                  2, &FrontendTextureDEFN );
  676.                 LoadTexturePage( BIN_PAGE18,
  677.                  &EuroDATfile[0],
  678.                  3, &FrontendTextureDEFN );
  679.                 LoadTexturePage( BIN_PAGE19,
  680.                  &EuroDATfile[0],
  681.                  4, &FrontendTextureDEFN );
  682.                     break;
  683.  
  684.             case( FINAL_MATCH ):
  685.                 LoadTexturePage( BIN_PAGE23,
  686.                  &EuroDATfile[0],
  687.                  2, &FrontendTextureDEFN );
  688.                 LoadTexturePage( BIN_PAGE24,
  689.                  &EuroDATfile[0],
  690.                  3, &FrontendTextureDEFN );
  691.                 LoadTexturePage( BIN_PAGE25,
  692.                  &EuroDATfile[0],
  693.                  4, &FrontendTextureDEFN );
  694.                 LoadTexturePage( BIN_PAGE26,
  695.                  &EuroDATfile[0],
  696.                  5, &FrontendTextureDEFN );
  697.                     break;
  698.         }
  699.     }
  700.  
  701. //********************************************************************************************************************************
  702.  
  703. void    __far EUROinterupt(void)
  704.  
  705.     {
  706.  
  707.     fixed    red, green, blue;
  708.  
  709.         if ( LogicState == PALETTE_FADEUP )
  710.         {
  711.             if ( FadeCounter < 1 || FadeCounter > FADE_COUNTER )
  712.             {
  713.                 fixed        *a;
  714.                 BYTE         *Palette;    
  715.                 a        =    &DivisionTable[0];
  716.                 Palette        =    &PaletteBuffer[0];
  717.  
  718.                 FadeCounter      =      FADE_COUNTER;
  719.  
  720.                 for ( int c=0; c < 256; c++ )
  721.                 {
  722.                     red        =    (*(Palette++));        
  723.                     green        =    (*(Palette++));        
  724.                     blue        =    (*(Palette++));        
  725.                     (*(a++))    =    red / FADE_COUNTER;
  726.                     (*(a++))    =    green / FADE_COUNTER;
  727.                     (*(a++))    =    blue / FADE_COUNTER;
  728.                 }
  729.  
  730.                 memset( CurrentPalette, 0, 768 );
  731.             }
  732.     
  733.             fixed    *a;
  734.             fixed    *b;
  735.             BYTE     *Palette;    
  736.         
  737.             a        =    &CurrentPalette[0];
  738.             b        =    &DivisionTable[0];
  739.  
  740.             for ( int c=0; c < 256; c++ )
  741.             {
  742.                 red        =    (fixed) (*(a)) + (*(b++));
  743.                 (*(a++))    =    red;
  744.                 green        =    (fixed) (*(a)) + (*(b++));
  745.                 (*(a++))    =    green;
  746.                 blue        =    (fixed) (*(a)) + (*(b++));
  747.                 (*(a++))    =    blue;
  748.                 outp    ( 0x3c8, c );
  749.                 outp    ( 0x3c9, (BYTE) red );
  750.                 outp    ( 0x3c9, (BYTE) green );
  751.                 outp    ( 0x3c9, (BYTE) blue );
  752.             }
  753.         
  754.             FadeCounter = FadeCounter -1;
  755.     
  756.             if ( FadeCounter < 1 ) 
  757.             {          
  758.                 Palette        =    &PaletteBuffer[0];
  759.                 for ( int c=0; c < 256; c++ )
  760.                        {
  761.                         outp    ( 0x3c8, c );
  762.                         outp    ( 0x3c9, (*( Palette++ ) ) );
  763.                         outp    ( 0x3c9, (*( Palette++ ) ) );
  764.                         outp    ( 0x3c9, (*( Palette++ ) ) );
  765.                     }
  766.  
  767.                 fixed        *a;
  768.                 BYTE         *Palette;    
  769.                 a        =    &CurrentPalette[0];
  770.                 Palette        =    &PaletteBuffer[0];
  771.  
  772.                 for ( int d=0; d < 256; d++ )
  773.                     {
  774.                         red        =    (*(Palette++));        
  775.                         green        =    (*(Palette++));        
  776.                         blue        =    (*(Palette++));        
  777.                         (*(a++))    =    red;
  778.                         (*(a++))    =    green;
  779.                         (*(a++))    =    blue;
  780.                     }
  781.  
  782.                 LogicState = RUN_FRONTEND;
  783.                 FadeCounter = 0;
  784.             }
  785.         }
  786.  
  787.         else
  788.  
  789.         if ( LogicState == PALETTE_FADEDOWN )
  790.         {
  791.             if ( FadeCounter < 1 || FadeCounter > FADE_COUNTER )
  792.             {              
  793.                 fixed        *a;
  794.                 fixed         *Palette;    
  795.                 a        =    &DivisionTable[0];
  796.                 Palette        =    &CurrentPalette[0];
  797.  
  798.                 FadeCounter      =      FADE_COUNTER;
  799.  
  800.                 for ( int c=0; c < 256; c++ )
  801.                 {
  802.                     red        =    (*(Palette++));        
  803.                     green        =    (*(Palette++));        
  804.                     blue        =    (*(Palette++));        
  805.                     (*(a++))    =    red / FADE_COUNTER;
  806.                     (*(a++))    =    green / FADE_COUNTER;
  807.                     (*(a++))    =    blue / FADE_COUNTER;
  808.                 }
  809.             }
  810.  
  811.             fixed    *a;
  812.             fixed    *b;
  813.             BYTE     *Palette;    
  814.         
  815.             a        =    &CurrentPalette[0];
  816.             b        =    &DivisionTable[0];
  817.  
  818.             for ( int c=0; c < 256; c++ )
  819.             {
  820.                 red        =    (fixed) (*(a)) - (*(b++));
  821.                 (*(a++))    =    red;
  822.                 green        =    (fixed) (*(a)) - (*(b++));
  823.                 (*(a++))    =    green;
  824.                 blue        =    (fixed) (*(a)) - (*(b++));
  825.                 (*(a++))    =    blue;
  826.                 outp    ( 0x3c8, c );
  827.                 outp    ( 0x3c9, (BYTE) red );
  828.                 outp    ( 0x3c9, (BYTE) green );
  829.                 outp    ( 0x3c9, (BYTE) blue );
  830.             }
  831.         
  832.             FadeCounter = FadeCounter -1;
  833.     
  834.             if ( FadeCounter < 1 ) 
  835.             {
  836.                 for ( int c=0; c < 256; c++ )
  837.                    {
  838.                     outp    ( 0x3c8, c );
  839.                     outp    ( 0x3c9, 0 );
  840.                     outp    ( 0x3c9, 0 );
  841.                     outp    ( 0x3c9, 0 );
  842.                 }
  843.  
  844.                 memset( CurrentPalette, 0, 768 );
  845.                 FadeCounter     = 0;
  846.                 LogicState     = BLANK_SCREEN;
  847.                 Finish++;
  848.             }
  849.         }
  850.  
  851.         if ( LogicState == RUN_FRONTEND )  
  852.                             
  853.                 SelectFrame+=    f2L(.55); 
  854.         else                     
  855.                 SelectFrame =    0;   
  856.  
  857.         CursorDisplaySpeed+=    f2L(.05);
  858.         
  859.         if ( CursorDisplaySpeed > 1 )
  860.             CursorDisplaySpeed-=    f2L(1.0);
  861.     }
  862.  
  863.  
  864. //********************************************************************************************************************************
  865.  
  866. void    DisplayBoundingBoxes()
  867.     {
  868.         for ( int b=0; b < MAX_BOUNDING_BOXES; b++ )
  869.         {
  870.                    if ( Bounding_table[b].BoundingBoxLeft != -1 )
  871.                 printf("%d used \n",b);
  872.                 fflush(stdout);                
  873.         }
  874.     }
  875.  
  876. //********************************************************************************************************************************
  877.  
  878. void    ResetBoundingBoxes()
  879.     {
  880.         for ( short b=0; b < MAX_BOUNDING_BOXES; b++ )
  881.         {
  882.             Bounding_table[b].BoundingBoxLeft    =    -1;
  883.             Bounding_table[b].BoundingBoxRight    =    -1;
  884.             Bounding_table[b].BoundingBoxTop    =    -1;
  885.             Bounding_table[b].BoundingBoxBottom    =    -1;
  886.         }                
  887.     }    
  888.  
  889. //********************************************************************************************************************************
  890.  
  891. signed char GetBoundingBox( short xposn, short yposn )
  892.     {
  893.  
  894.     signed char box    =    -1;
  895.  
  896.         for ( int b=0; b < MAX_BOUNDING_BOXES; b++ )
  897.         {
  898.                    if ( xposn > Bounding_table[b].BoundingBoxLeft
  899.                   && xposn < Bounding_table[b].BoundingBoxRight
  900.                           && yposn > Bounding_table[b].BoundingBoxTop
  901.                     && yposn < Bounding_table[b].BoundingBoxBottom
  902.                  && Bounding_table[b].BoundingBoxLeft>=0
  903.                     )
  904.                         
  905.                     box    =    b;
  906.         }
  907.  
  908.         return(box);
  909.     }
  910.  
  911.                  
  912. //********************************************************************************************************************************
  913.  
  914. void StartingEURO_96( char gametype )
  915.     {
  916.         if ( gametype == EURO_network_game )
  917.             EUROcommTYPE = 0;
  918.         if ( gametype == EURO_serial_game )
  919.             EUROcommTYPE = 1;
  920.         if ( gametype == EURO_modem_game )
  921.             EUROcommTYPE = 2;
  922.         if ( gametype == EURO_wireplay )
  923.             EUROcommTYPE = 3;
  924.  
  925.         if ( EUROcommOVERIDE <128 )
  926.             EUROcommTYPE = EUROcommOVERIDE;
  927.  
  928.         if ( EUROverbose != 0 )
  929.         {
  930.             printf("˛ Calling Set_Comm_Type with comm type: %d\n", EUROcommTYPE );
  931.             fflush(stdout);                
  932.         }
  933.  
  934.         Set_Comm_Type( EUROcommTYPE );            // 0 network 1 serial 2 modem 3 wireplay
  935.  
  936.         if ( EUROverbose != 0 )
  937.         {
  938.             printf("˛ Calling Start_Network_Game.\n");
  939.             fflush(stdout);                
  940.         }
  941.  
  942.         if ( Start_Network_Game() != 0 )
  943.         {            
  944.             if ( gametype == EURO_wireplay )
  945.             {                
  946.                 printf ("˛ ERROR, cannot initialise WIREPLAY game.\n");
  947.                 fflush(stdout);
  948.             }
  949.             
  950.             if ( gametype == EURO_network_game )
  951.             {                
  952.                 printf ("˛ ERROR, cannot initialise NETWORK game.\n");
  953.                 fflush(stdout);
  954.             }
  955.             
  956.             if ( gametype == EURO_serial_game )
  957.             {                
  958.                 printf ("˛ ERROR, cannot initialise SERIAL game.\n");
  959.                 fflush(stdout);
  960.             }
  961.             
  962.             if ( gametype == EURO_modem_game )
  963.             {                
  964.                 printf ("˛ ERROR, cannot initialise MODEM game.\n");
  965.                 fflush(stdout);
  966.             }
  967.  
  968.             EUROgameType          =     EURO_friendly;
  969.         }
  970.  
  971.             else        
  972.  
  973.         {
  974.             EURO_NetSelectionMade    =    No;
  975.             for (char t=0; t<20; t++)
  976.             {TickPause();}
  977.         }
  978.     }
  979.  
  980. //********************************************************************************************************************************
  981.  
  982. void DoMainScreen( char MENU )
  983.     {
  984.         if ( MENU == MAIN && LogicState == RUN_FRONTEND )
  985.         {
  986.             if ( ButtonState != 0 )
  987.             {
  988.                 ChangeMenu    =    TEAM_SELECT;
  989.                      DeBounce      =     TRUE;
  990.                 EUROoveride    =    0;
  991.  
  992.                 if ( EUROgameType == EURO_network_game || 
  993.                     EUROgameType == EURO_modem_game ||
  994.                     EUROgameType == EURO_serial_game )
  995.                         StartingEURO_96( EUROgameType );
  996.             }
  997.         }
  998.            }
  999.  
  1000. //********************************************************************************************************************************
  1001.  
  1002. char    ConfigureTeamView()
  1003.     {
  1004.         if ( EUROteamView&=1 )
  1005.             return(EUROteamB);
  1006.         else
  1007.             return(EUROteamA);
  1008.     }
  1009.                 
  1010. //********************************************************************************************************************************
  1011.